{extend name="common/common"}
{block name="content"}
        <div class="">
            <div class="tpl-content-page-title">
                Amaze UI 商品列表
            </div>
            <ol class="am-breadcrumb">
                <li><a href="__ADMIN__#" class="am-icon-home">首页</a></li>
                <li><a href="__ADMIN__#">Amaze UI CSS</a></li>
                <li class="am-active">商品列表</li>
            </ol>
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                    <div class="caption font-green bold">
                        <span class="am-icon-code"></span> 列表
                    </div>
                    <form action="">
                    <div class="tpl-portlet-input tpl-fz-ml">
                        <div class="portlet-input input-small input-inline">
                            <div class="input-icon right">
                                <i class="am-icon-search"></i>
                                <input type="text" class="form-control form-control-solid" placeholder="搜索..."></div>
                        </div>
                    </div>
                    </form>

                </div>
                <div class="tpl-block">
                    <div class="am-g">
                        <div class="am-u-sm-12 am-u-md-6">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span><a href="{:url('tableadd')}" target="_blank">添加</a></button>
                                    <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                </div>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                <select data-am-selected="{btnSize: 'sm'}">
              <option value="option1">所有类别</option>
              <option value="option2">IT业界</option>
              <option value="option3">数码产品</option>
              <option value="option3">笔记本电脑</option>
              <option value="option3">平板电脑</option>
              <option value="option3">只能手机</option>
              <option value="option3">超极本</option>
            </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field">
                                <span class="am-input-group-btn">
            <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" type="button"></button>
          </span>
                            </div>
                        </div>
                    </div>
                    <div class="am-g">
                        <div class="am-u-sm-12">
                            <form class="am-form">
                                <table class="am-table am-table-striped am-table-hover table-main">
                                    <thead>
                                        <tr>
                                            <th class="table-check"><input type="checkbox" class="tpl-table-fz-check"></th>
                                            <th class="table-id">ID</th>
                                            <th class="table-title">标题</th>
                                            <th class="table-type">封面图</th>
                                            <th class="table-author am-hide-sm-only">作者</th>
                                            <th class="table-date am-hide-sm-only">修改日期</th>
                                            <th class="table-set">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody class="hhtml">

                                    </tbody>
                                </table>
                                <div class="am-cf">

                                    <div class="am-fr" id="page">
                                      {$page}
                                    </div>
                                </div>
                                <hr>

                            </form>
                        </div>

                    </div>
                </div>
                <div class="tpl-alert"></div>
            </div>
        </div>
<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">Amaze UI</div>
        <div class="am-modal-bd">
            你，确定要删除这条记录吗？
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn quxiao" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn que" data-am-modal-confirm>确定</span>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script src="__ADMIN__/assets/js/template.js"></script>

<script id="ajax" type="text/html">
<%for(var i=0;i<data.length;i++){%>
<tr>
    <td><input type="checkbox"></td>
    <td><%=data[i].id%></td>
    <td><%=data[i].tradename%></td>
    <td><img src="__ADMIN__images/uploads/<%=data[i].img%>" alt="" style="width:150px;height:80px;"></td>
    <td><%=data[i].time%></td>
    <td><%=data[i].notes%></td>
    <td>
        <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
                <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"><a href="{:url('spec/ware_spec')}?id=<%=data[i].id%>">规格</a></span></button>
                <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"><a href="{:url('tabledate')}?id=<%=data[i].id%>">编辑</a></span></button>
                <button class="am-btn am-btn-default am-btn-xs am-hide-sm-only"><span class="am-icon-copy"></span> 复制</button>
                <button type="button" id="butt" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"><a id="aaa" href="<%=data[i].id%>" >删除</a></span>
            </div>
        </div>
    </td>
</tr>
<%}%>

</script>
<script>
    $('#page').on('click','li',function(e){
        e.preventDefault();
        var url = $(this).children().attr('href');
        $.ajax({
            url:url,
            processData:false,
            contentType:false,
            success:function(res){
                // console.log(res);
                var html = template($('#ajax').html(),{data:res.select.data})
                $('.hhtml').html(html)
                $('#page').html(res.page)
            }
        })
    })
    $('.hhtml').on('click','#aaa',function(e){
        e.preventDefault()  
        $('#my-confirm').modal()
        var url = $(this).attr('href')
        $('.que').click(function(){
            $.ajax({
                url:'{:url("tabledelete")}?id='+url,
                success:function(res) {
                    consol.log(res);
                }
            })
        })
    })
</script>
{/block}


